import request from '@/utils/request'

export function paginate(form, page, page_size) {
  return request({
    url: '/api/sys/user/inside/paginate',
    method: 'post',
    data: {
      page_num: page,
      page_size: page_size,
      search_key: form.search_key
    }
  })
}

export function save(form) {
  return request({
    url: '/api/sys/user/inside/save',
    method: 'post',
    data: {
      user_name: form.user_name,
      user_phone: form.user_phone,
      user_sex: form.user_sex
    }
  })
}

export function update(form) {
  return request({
    url: '/api/sys/user/inside/update',
    method: 'post',
    data: {
      user_name: form.user_name,
      user_id: form.user_id,
      user_sex: form.user_sex
    }
  })
}

export function disable(user_id) {
  return request({
    url: '/api/sys/user/inside/disable',
    method: 'post',
    data: {
      user_id: user_id
    }
  })
}

export function enable(user_id) {
  return request({
    url: '/api/sys/user/inside/enable',
    method: 'post',
    data: {
      user_id: user_id
    }
  })
}

export function roleTree(user_id) {
  return request({
    url: '/api/sys/user/inside/role/tree',
    method: 'post',
    data: {
      user_id: user_id
    }
  })
}

export function roleUpdate(user_id, role_id) {
  return request({
    url: '/api/sys/user/inside/role/update',
    method: 'post',
    data: {
      user_id: user_id,
      role_id: role_id
    }
  })
}
